using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace DTO
{
	/// <summary> 
	///Author: daiduong19051986@gmail.com 
	/// <summary>
	
    public class IcunitConversionsInfo
    {
		#region Local Variable
		public enum Field
		{
			Monedb,
			Unitfrom,
			Unitto,
			Description,
			Operator,
			Factor,
			Createdby,
			Insertpointoftime,
			Updatedby,
			Lastupdate
		}
		private String _Monedb;
		private String _Unitfrom;
		private String _Unitto;
		private String _Description;
		private String _Operator;
		private Double _Factor;
		private String _Createdby;
		private DateTime _Insertpointoftime;
		private String _Updatedby;
		private DateTime _Lastupdate;
		
		public String Monedb{	get{ return _Monedb;} set{_Monedb = value;} }
		public String Unitfrom{	get{ return _Unitfrom;} set{_Unitfrom = value;} }
		public String Unitto{	get{ return _Unitto;} set{_Unitto = value;} }
		public String Description{	get{ return _Description;} set{_Description = value;} }
		public String Operator{	get{ return _Operator;} set{_Operator = value;} }
		public Double Factor{	get{ return _Factor;} set{_Factor = value;} }
		public String Createdby{	get{ return _Createdby;} set{_Createdby = value;} }
		public DateTime Insertpointoftime{	get{ return _Insertpointoftime;} set{_Insertpointoftime = value;} }
		public String Updatedby{	get{ return _Updatedby;} set{_Updatedby = value;} }
		public DateTime Lastupdate{	get{ return _Lastupdate;} set{_Lastupdate = value;} }
		
        #endregion LocalVariable
        
        #region Constructor
		public IcunitConversionsInfo()
		{
			_Monedb = "";
			_Unitfrom = "";
			_Unitto = "";
			_Description = "";
			_Operator = "";
			_Factor = 0;
			_Createdby = "";
			_Insertpointoftime = DateTime.Now;
			_Updatedby = "";
			_Lastupdate = DateTime.Now;
		}
		public IcunitConversionsInfo(
		String Monedb,
		String Unitfrom,
		String Unitto,
		String Description,
		String Operator,
		Double Factor,
		String Createdby,
		DateTime Insertpointoftime,
		String Updatedby,
		DateTime Lastupdate
		)
		{
			_Monedb = Monedb;
			_Unitfrom = Unitfrom;
			_Unitto = Unitto;
			_Description = Description;
			_Operator = Operator;
			_Factor = Factor;
			_Createdby = Createdby;
			_Insertpointoftime = Insertpointoftime;
			_Updatedby = Updatedby;
			_Lastupdate = Lastupdate;
		}
		public IcunitConversionsInfo(DataRow dr)
		{
			if (dr != null)
			{
				_Monedb = dr[Field.Monedb.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.Monedb.ToString()]);
				_Unitfrom = dr[Field.Unitfrom.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.Unitfrom.ToString()]);
				_Unitto = dr[Field.Unitto.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.Unitto.ToString()]);
				_Description = dr[Field.Description.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.Description.ToString()]);
				_Operator = dr[Field.Operator.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.Operator.ToString()]);
				_Factor = dr[Field.Factor.ToString()] == DBNull.Value?0:Convert.ToDouble(dr[Field.Factor.ToString()]);
				_Createdby = dr[Field.Createdby.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.Createdby.ToString()]);
				_Insertpointoftime = dr[Field.Insertpointoftime.ToString()] == DBNull.Value?DateTime.Now:Convert.ToDateTime(dr[Field.Insertpointoftime.ToString()]);
				_Updatedby = dr[Field.Updatedby.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.Updatedby.ToString()]);
				_Lastupdate = dr[Field.Lastupdate.ToString()] == DBNull.Value?DateTime.Now:Convert.ToDateTime(dr[Field.Lastupdate.ToString()]);
			}
		}
		public IcunitConversionsInfo(DataRowView dr)
		{
			if (dr != null)
			{
				_Monedb = dr[Field.Monedb.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.Monedb.ToString()]);
				_Unitfrom = dr[Field.Unitfrom.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.Unitfrom.ToString()]);
				_Unitto = dr[Field.Unitto.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.Unitto.ToString()]);
				_Description = dr[Field.Description.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.Description.ToString()]);
				_Operator = dr[Field.Operator.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.Operator.ToString()]);
				_Factor = dr[Field.Factor.ToString()] == DBNull.Value?0:Convert.ToDouble(dr[Field.Factor.ToString()]);
				_Createdby = dr[Field.Createdby.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.Createdby.ToString()]);
				_Insertpointoftime = dr[Field.Insertpointoftime.ToString()] == DBNull.Value?DateTime.Now:Convert.ToDateTime(dr[Field.Insertpointoftime.ToString()]);
				_Updatedby = dr[Field.Updatedby.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.Updatedby.ToString()]);
				_Lastupdate = dr[Field.Lastupdate.ToString()] == DBNull.Value?DateTime.Now:Convert.ToDateTime(dr[Field.Lastupdate.ToString()]);
			}
		}
		public IcunitConversionsInfo(IcunitConversionsInfo objEntr)
		{			
			_Monedb = objEntr.Monedb;			
			_Unitfrom = objEntr.Unitfrom;			
			_Unitto = objEntr.Unitto;			
			_Description = objEntr.Description;			
			_Operator = objEntr.Operator;			
			_Factor = objEntr.Factor;			
			_Createdby = objEntr.Createdby;			
			_Insertpointoftime = objEntr.Insertpointoftime;			
			_Updatedby = objEntr.Updatedby;			
			_Lastupdate = objEntr.Lastupdate;			
		}
        #endregion Constructor
        
        #region InitTable
		public DataTable ToDataTable()
		{
			DataTable dt = new DataTable("IcunitConversions");
			dt.Columns.AddRange(new DataColumn[] { 
				new DataColumn(Field.Monedb.ToString(), typeof(String)),
				new DataColumn(Field.Unitfrom.ToString(), typeof(String)),
				new DataColumn(Field.Unitto.ToString(), typeof(String)),
				new DataColumn(Field.Description.ToString(), typeof(String)),
				new DataColumn(Field.Operator.ToString(), typeof(String)),
				new DataColumn(Field.Factor.ToString(), typeof(Double)),
				new DataColumn(Field.Createdby.ToString(), typeof(String)),
				new DataColumn(Field.Insertpointoftime.ToString(), typeof(DateTime)),
				new DataColumn(Field.Updatedby.ToString(), typeof(String)),
				new DataColumn(Field.Lastupdate.ToString(), typeof(DateTime))
			});
			return dt;
		}
		public DataRow ToDataRow(DataTable dt)
		{
			DataRow row = dt.NewRow();
			row[Field.Monedb.ToString()] = _Monedb;
			row[Field.Unitfrom.ToString()] = _Unitfrom;
			row[Field.Unitto.ToString()] = _Unitto;
			row[Field.Description.ToString()] = _Description;
			row[Field.Operator.ToString()] = _Operator;
			row[Field.Factor.ToString()] = _Factor;
			row[Field.Createdby.ToString()] = _Createdby;
			row[Field.Insertpointoftime.ToString()] = _Insertpointoftime;
			row[Field.Updatedby.ToString()] = _Updatedby;
			row[Field.Lastupdate.ToString()] = _Lastupdate;
			return row;
		}
        #endregion InitTable
    }
}
